<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    function arr(A) {
      let s1 = 0, s2 = 0
      for (let i = 0; i < A.length - 1; i++) {
        if (A[i] < A[i + 1]) {
          s2 = 1
          if (s1 == 1) return false;
        } else if (A[i] > A[i + 1]) {
          s1 = 1
        } else return false;

      }
      return s1 == 1 && s2 == 1 && A.length > 2 ? true : false;
    };
    console.log(arr([2, 1]));
  </script>
</body>

</html>